package com.bolang.onlycode.demo.MyThread;



public class GoalNotifier implements Runnable {
    private volatile boolean goal;
    public boolean isGoal(){
        return goal;
    }
    public void setGoal(boolean goal){
        this.goal=goal;
    }


    @Override
    public void run() {
        while (true){
          //  System.out.println("进入当前线程"+Thread.currentThread().getName());
            if(isGoal()){
                System.out.println(Thread.currentThread().getName()+"Goal !!!!!!!!");

                setGoal(false);
            }
        }
    }
}
